package com.github.phoenics.bazooka.restcontroller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.phoenics.bazooka.domain.po.Room;
import com.github.phoenics.bazooka.domain.po.Student;
import com.github.phoenics.bazooka.service.RoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Phoenics Chow
 * on 2019年02月10日
 */
@RestController
@RequestMapping("t/room")
public class RoomController {
    private static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RoomController.class);
    @Autowired
    RoomService roomService;
    @GetMapping("/listby")
    public IPage<Student> listby(){
        Room r=new Room();
        r.setId(1L);
        return roomService.studentsInRoom(new Page<>(),r);
    }
    @GetMapping("/listby2")
    public List<Student> listby2(){
        Room r=new Room();
        r.setId(1L);
        return roomService.studentsInRoom(r);
    }
    @GetMapping("/listby3")
    public IPage<Room> listby3(){
        return roomService.page(new Page<>());
    }
}
